package com.sm.ticket.api.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.sm.ticket.mapper.TicketDao;
import com.sm.tool.entity.dto.UpdateTicketsStatusDTO;
import com.sm.tool.entity.po.Tickets_;
import com.sm.tool.entity.po.User_;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @program: practice
 * @description:
 * @author: liqitian.
 * @create: 2019-11-27 16:51
 **/
@Service
@Slf4j
public class TicketInsideService {

    @Autowired
    private TicketDao ticketDao;

    public Tickets_ query_like_ticket_code(String ticketCode) {
        log.info("ticketCode:{}", ticketCode);
        QueryWrapper<Tickets_> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("ticket_code", ticketCode);
        return ticketDao.selectOne(queryWrapper);
    }

    public List<Tickets_> queryTicketListByIds(List<Long> ticketIds) {

        if (ticketIds == null || ticketIds.isEmpty()) {
            return new ArrayList<>();
        }
        QueryWrapper<Tickets_> ticketsQueryWrapper = new QueryWrapper<>();
        ticketsQueryWrapper.in("id", ticketIds);
        return ticketDao.selectList(ticketsQueryWrapper);
    }

}
